package test;

import java.io.IOException;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@WebServlet("/context")
public class ServletContextServlet extends HttpServlet{
	

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		ServletContext servletContext = getServletContext();
//		<!-- param:parameter 参数 -->
//		  <context-param>
//		  	<param-name>pageSize</param-name>
//		  	<param-value>20</param-value>
//		</context-param>
		String pageSize = servletContext.getInitParameter("pageSize");
		System.out.println(pageSize);
		servletContext.setAttribute("name", "王五");
		HttpSession session = req.getSession();
		session.setAttribute("name", "李四");
	}
}
